package com.heima.user.controller.v1;

import com.heima.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Version: V1.0
 */
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController {

    @Autowired
    ApUserRealnameService apUserRealnameService;

    @PostMapping("list")
    public ResponseResult listPage(@RequestBody AuthDto authDto) {
        return apUserRealnameService.listPage(authDto);
    }

    /**
     * 通过
     * @param dto
     * @return
     */
    @PostMapping("authPass")
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        return apUserRealnameService.updateStatusById(dto, AdminConstants.PASS_AUTH);
    }


    /**
     * 驳回
     * @param dto
     * @return
     */
    @PostMapping("authFail")
    public ResponseResult authFail(@RequestBody AuthDto dto) {
        return apUserRealnameService.updateStatusById(dto, AdminConstants.FAIL_AUTH);
    }

}
